<?php
/**
 * Created by PhpStorm.
 * User: iceberg
 * Date: 2018-10-13
 * Time: 14:29
 */

namespace app\validate;


use think\Validate;

class OrderValidate extends Validate
{
    protected $rule = [
        'name'          =>  'require|max:30|unique:order',
        'author'        =>  'require|max:10',
        'supplier_id'   =>  'require',
        'storage_id'    =>  'require',
        'status'        =>  'require',
        'desc'          =>  'max:100',
    ];

    protected $message  =   [
        'name.require'          =>  '订单名称必填',
        'name.max'              =>  '订单名称最多不能超过30个字符',
        'name.unique'           =>  '订单名称不能重复',
        'author.require'        =>  '填表人必填',
        'author.max'            =>  '填表人最多不能超过10个字符',
        'supplier_id.require'   =>  '供应商必填',
        'storage_id.require'    =>  '仓库必填',
        'status.require'        =>  '订单状态必填',
        'desc.max'              =>  '备注最多不能超过100个字符',
    ];

    //场景
    protected $scene = [
        'inorder'   =>  ['name', 'author', 'supplier_id', 'storage_id', 'status'],
        'outorder'  =>  ['name', 'author', 'supplier_id', 'storage_id', 'status', 'customer_id'],
    ];
}